package g.beny.framework.filter;

import g.beny.framework.constant.Constant;

import org.nutz.mvc.ActionContext;
import org.nutz.mvc.ActionFilter;
import org.nutz.mvc.View;
import org.nutz.mvc.view.HttpStatusView;
import org.nutz.mvc.view.ServerRedirectView;

/**
 * session过期检测
 * @author GodSon
 *
 */
public class SessionCheckFilter implements ActionFilter {

	/* Session检测
	 * @see org.nutz.mvc.ActionFilter#match(org.nutz.mvc.ActionContext)
	 */
	@Override
	public View match(ActionContext context) {
		/*Object obj = context.getRequest().getSession().getAttribute(Constant.Config.PRO_USER_SESSION_KEY);
		//TODO
		if (false){
			String requestType = context.getRequest().getHeader("X-Requested-With");
			//判断是否是ajax请求，如果是ajax请求，就返回http状态码为1001。否则进行界面跳转
			if(requestType != null && requestType.equals("XMLHttpRequest")){
				return new HttpStatusView(Constant.HttpCode.NO_LOGIN);
			}
			return new ServerRedirectView("");
		}*/
			
		return null;
	}

}
